package com.yike.user.param;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 店铺表
 *
 * @author Sakura
 * @since 2024-08-26
 */
@Data
@ApiModel(value = "周围店铺参数")
public class AroundShopParam implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("店铺名称模糊搜索")
    private String keyword;

    @ApiModelProperty("经度")
    @NotNull(message = "请先获取位置信息")
    private BigDecimal longitude;

    @ApiModelProperty("维度")
    @NotNull(message = "请先获取位置信息")
    private BigDecimal latitude;

    @ApiModelProperty(value = "距离（米） 默认为10000米", example = "10000")
    private Integer distance = 10000;  // 默认值为10000米

    @ApiModelProperty(value = "店铺数量", example = "100")
    private Integer size = 100;

    public void setDistance(Integer distance) {
        if (distance == null || distance == 0) {
            this.distance = 10000;  // 默认值为10000米
        } else {
            this.distance = distance;
        }
    }

    public void setSize(Integer size) {
        if (size == null || size == 0) {
            this.size = 10;  // 默认值为10000米
        } else {
            this.size = size;
        }
    }

}
